package org.pvt.model;

import org.jetbrains.annotations.NotNull;

import java.util.HashSet;
import java.util.Set;

import static org.pvt.model.Models.Category;

/**
 * @author Pavel Talanov
 */
public final class Expense extends HasNameAndBelongsToEvent {

    @SuppressWarnings("FieldCanBeLocal")
    @NotNull
    private static String TABLE_NAME = "expenses";
    @NotNull
    public static String TOTAL = "total";
    @NotNull
    public static String DATE = "date";
    @NotNull
    public static String COMMENT = "comment";

    @NotNull
    @Override
    public String getTableName() {
        return TABLE_NAME;
    }

    @NotNull
    @Override
    protected Set<Field> getFields() {
        Set<Field> fields = new HashSet<Field>(super.getFields());
        fields.add(new Field(Category, Behaviour.RESTRICT));
        fields.add(new Field(TOTAL, "REAL"));
        fields.add(new Field(DATE, "DATETIME"));
        fields.add(new Field(COMMENT, "TEXT"));
        return fields;
    }

}
